<script setup>
import { getHomeOthertab } from '../api/home';
import { ref, onBeforeMount } from 'vue';

// const props = defineProps(['id5','type5']);
// let id = props.id5;
// let type = props.type5;
// console.log("笔记本=",id,type)

let laptopList = ref([])
let laptopList1 = ref([])
let laptopList2 = ref([])
let getHomeOthertabFun = () => {
    getHomeOthertab({
        page_type: 'activity',
        page_id: 13176
    }).then(res => {
        // console.log("笔记本的数据=>",res)
        laptopList.value = res.data.data.data.sections
        console.log("laptopList=", laptopList.value)
        laptopList1.value = res.data.data.data.sections[1].body.items.concat(res.data.data.data.sections[3].body.items, res.data.data.data.sections[5].body.items, res.data.data.data.sections[7].body.items, res.data.data.data.sections[9].body.items, res.data.data.data.sections[11].body.items)
        laptopList2.value = res.data.data.data.sections[13].body.items.concat( res.data.data.data.sections[14].body.items,res.data.data.data.sections[15].body.items,res.data.data.data.sections[16].body.items )

    })
}

onBeforeMount(() => {
    getHomeOthertabFun()
})

</script>

<template>
     <van-loading type="spinner" color="#ff6900" v-if="!laptopList" vertical/>
    <div class="laptop-page" v-else>
        <div class="laptop-item" v-for="(item, index) in laptopList1" :key="index">
            <img :src="'https:' + item.img_url" alt="">
            <div class="describe" v-if="item.product_name">
                <div class="lineone">
                    <p class="product_name">{{ item.product_name }}</p>
                    <p class="show_price"> ￥{{ item.show_price }}起</p>
                </div>
                <div class="linetwo">
                    <p class="product_brief">{{ item.product_brief }}</p>
                    <button>立即购买</button>
                </div>
            </div>
        </div>

        <div class="laptop-footer" >
            <img :src="'https:'+item.img_url" v-for="(item,index) in laptopList2" :key="index">
           
        </div>

    </div>
</template>

<style lang="scss">
.laptop-page {
    width: 100%;
    background-color: #4878a6;
    padding-top: 14px;
    .laptop-item {
        width: 100%;
        // margin-top: 14px;
        margin-bottom: 14px;
        img {
            width: 100%;
        }

        .describe {
            width: 100%;
            height: 75px;
            background-color: #fff;
            box-sizing: border-box;
            padding: 15px;

            .lineone,
            .linetwo {
                display: flex;
                justify-content: space-between;
                // margin-top: 3px;

                .product_name {
                    font-size: 13px;
                }

                .show_price {
                    font-size: 13px;
                    color: #ea625b;
                }

                .product_brief {
                    height: 31px;
                    font-size: 11px;
                    color: #757575;
                    line-height: 31px;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    display: -webkit-box;
                    -webkit-line-clamp: 1;
                    -webkit-box-orient: vertical;
                }

                button {
                    width: 104px;
                    height: 31px;
                    background-color: #ea625b;
                    color: #fff;
                    border: none;
                    outline: none;
                    text-align: center;
                    line-height: 31px;
                    border-radius: 2px;
                    font-size: 12px;
                }
            }
        }
    }
    .laptop-footer{
        width: 100%;
        background-color: #fff;
        display: flex;
        flex-wrap: wrap;
        justify-content: space-evenly;
        img{
            width: 49%;
            height: auto;
        }
        img:nth-child(1){
            width: 100%;
            height: auto;
        }
        
    }
}
</style>